//
//  RightCollectionViewCell.m
//  TryFiles
//
//  Created by ChuXiang on 16/1/8.
//  Copyright © 2016年 ChuXiang. All rights reserved.
//

#import "RightCollectionViewCell.h"
@interface RightCollectionViewCell ()
@property (nonatomic, strong) UIImageView *image;
@property (nonatomic, strong) UILabel *textLabel;
@end
@implementation RightCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [UIImageView new];
        [self addSubview:self.image];
        
        self.textLabel = [UILabel new];
        self.textLabel.textAlignment = NSTextAlignmentCenter;
        [self.textLabel setFont:[UIFont fontWithName:@"FZLanTingHei-EL-GBK" size:12]];
        [self addSubview:self.textLabel];

    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    [super applyLayoutAttributes:layoutAttributes];
    self.image.frame = CGRectMake(0, 0, self.width, self.height - 15);
    self.textLabel.frame = CGRectMake(0, self.image.bottom, self.width, 15);
    
}



- (void)setModel:(CXGiftModel *)model {
    if (_model != model) {
        _model = model;
    }
    self.textLabel.text = model.name;
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.icon_url]];
}
@end
